package com.kotlinvben.controller

import com.kotlinvben.bean.Result
import com.kotlinvben.entity.Menu
import com.kotlinvben.entity.User
import com.kotlinvben.service.MenuService
import com.kotlinvben.utils.SecurityUtils
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * @author wxluo2
 * @date 2025/5/26 11:58
 */
@RestController
@RequestMapping
class ApiController(
    private val menuService: MenuService
) {

    @GetMapping("/user/info")
    fun getUserInfo(): Result<User> {
        return Result.success(
            SecurityUtils.getCurrentUser()
        )
    }

    @GetMapping("/menu/all")
    fun getAllMenus(): Result<List<Menu>> {
        return Result.success(menuService.getAllMenus())
    }

}